﻿using Model.DTO.Manager;
using System;
using System.Collections.Generic;
using WPay.Infrastructure.Unity;

namespace WPay.Infrastructure.Common
{
    /// <summary>
    /// 登录信息
    /// </summary>
    public class LoginInfo
    {
        /// <summary>
        /// 获取登录信息
        /// </summary>
        /// <returns></returns>
        public static LoginUserDTO GetCaheUser()
        {
            TokenModel tm = RayPIToken.GetTokenModel();
            var dto = Newtonsoft.Json.JsonConvert.DeserializeObject<LoginUserDTO>(tm.UserJson);
            if (dto == null)
            {
                dto = new LoginUserDTO();
                dto.DefActionList = new List<RoleAction_ModuleDTO>();
                dto.UserActionList = new List<RoleActionDTO>();
            }
            return dto;
        }
    }
}
